home *** CD-ROM | disk | FTP | other *** search
- Path: wabbit.its.uow.edu.au!not-for-mail
- From: sjl01@wumpus.its.uow.edu.au (Stuart John Langley)
- Newsgroups: comp.lang.c++
- Subject: Help: Bitwise operators
- Date: 13 Apr 1996 14:40:03 +1000
- Organization: University of Wollongong, NSW, Australia.
- Message-ID: <4knb73$f15@wumpus.its.uow.edu.au>
- NNTP-Posting-Host: wumpus.its.uow.edu.au
- X-Newsreader: NN version 6.5.0 #5
-
- Hi All,
-
- I need some help understanding some code that i need to translate.
- I have the following,
-
- unsigned char byte;
-
- then either -
-
- byte = (byte >> 1) | 0;
-
- or
-
- byte = (byte >> 1) | 128;
-
- I know that the first case places a 0 in the left most bit of byte,
- and moves everything else to the right, while the second places a 1
- in the leftmost bit. However, when I look at the texts and hepfiles,
- this seems to indicate thet the 0 or 1 should be placed in the rightmost
- bit and everything else moved left. Can somebody please help me out with
- this problem>
-
- Thanks,
-
- Stuart
-
- --
- --
- sjl01@uow.edu.au | "Despite all my rage, I'm still just
- Stuart Langley | a rat in a cage."
- Wollongong, Australia | - SP
-